import { encode } from "querystring";
import http from "../../utils/Axios";
import axios from "axios";

const apiUrl = ''//'http://10.0.204.9:18003'

export async function submit(params: { [key: string]: any }) {
  let url = "/api/seh-auth/oauth/token"
  if(apiUrl){
    url = `${apiUrl}/seh-auth/oauth/token`
  }
  return axios.post(url, params, {
    headers:{
      "Content-Type" : "application/x-www-form-urlencoded;charset=utf-8"
    }
  } );
}
export async function submit1(params: { [key: string]: any }) {
  return axios.post('/app/keeper-user/oauth/token', params, {
    headers:{
      flag : 6,
       username: encode(params.username)
    }
  } );
}
export async function update(params: { [key: string]: any }) {
  return axios.post('/app/keeper-user/user/up-pwd', params);
}
export async function login(){
  return http<any>('get','/api/seh-user/info',{})
}
export async function autoLogin(params){
  return http<any>('get','/api/seh-user/charm/oauth/token',params)
}
export async function register(params){
  return http<any>('get','/api/seh-user/charm/register',params)
}
export async function userAuthInfo(){
  return http<any>('get','/app/keeper-special/publicSafety/securityProduce/userAuthInfo',{})
}
